<template>
	<div>
		<!-- 轮播 -->
		<swiper :indicatorDots="true" :autoplay="true" :interval="2000" :duration="500">
			<swiper-item v-for="(item,i) in carouselItems" :key="i">
				<image :src="item.img" style="width: 100%;" mode="widthFix" />
			</swiper-item>
		</swiper>
	</div>
</template>
<script>
	export default {
		data() {
			return {
				// 轮播数据
				carouselItems: [],
			};
		},
		onLoad() {
			this.loadData();
		},
		methods: {
			loadData() {
				// uni.request({
				// 	url: 'http://www.zjff495.cn:5058/app/v1/home/index', //仅为示例，并非真实接口地址。			   
				// 	success: (res) => {
				// 		console.log(res.data);
				// 		this.carouselItems = res.data.data.carouselList;
				// 		console.log(this.carouselItems)
				// 	}
				// });
				uni.request({
					url: 'http://www.zjff495.cn:5058/app/v1/home/index'
				}).then(result => {
					this.carouselItems = result.data.data.carouselList;
				}).catch(error => {
					console.log(error)
				})
			}
		}
	};
</script>
<style scoped>
</style>